/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * articulos_sie_promociones_alta.java
 *
 * Created on 13/09/2011, 09:53:21 AM
 */

package sie_invdis;



import java.sql.*;
import javax.swing.*;

import javax.swing.JOptionPane;
import javax.swing.JTable;
import javax.swing.JTable.*;
import java.awt.*;
import java.awt.event.*;
import java.util.Date;
import java.util.Calendar;
import java.text.SimpleDateFormat;
import java.text.ParseException;
import java.text.*;
import javax.swing.JFrame;

import org.jfree.data.category.DefaultCategoryDataset;
import org.jfree.ui.RefineryUtilities;
import javax.swing.Timer;

/**
 *
 * @author Michelle
 */
public class articulos_sie_promociones_alta extends javax.swing.JFrame {

    private javax.swing.table.DefaultTableModel jtable_modelo;
    private javax.swing.table.DefaultTableModel jtable_modelo_promoarticulos;

    private int buscamp=1;
    private int opbuscamp=1;
    private int control_enter=0;
    private bd_conexion x = new bd_conexion() ;
       //se creaa la variable resultset
    private ResultSet rs = null;
    private SimpleDateFormat formateadoresta = new SimpleDateFormat("yyyy-MM-dd");

       //llamo almetodo para establecer la conexion


    /** Creates new form articulos_sie_promociones_alta */
    public articulos_sie_promociones_alta() {
         this.iniciar_modelo_de_tabla();
        this.iniciar_modelo_artipromo();
        initComponents();
        this.buttonGroup1.setSelected(jrb_obexacto.getModel(), true);
        this.buttonGroup2.setSelected(jrb_bclave.getModel(), true);
        Calendar fechaini = Calendar.getInstance(); // obtiene la fecha actual
        fechaini.add(Calendar.DATE, -3); // decrementa la fecha en 3 dias.
        this.jdc_fechaprogramada.setDate(fechaini.getTime());
        this.jdc_fechaaplica.setDate(fechaini.getTime());
        this.jdc_rangoini.setDate(fechaini.getTime());
        this.jdc_rangofinal.setDate(fechaini.getTime());
        this.jdc_fecharevision.setDate(fechaini.getTime());
        this.loadcombostatus();
    }

private void iniciar_modelo_de_tabla()
    {
        jtable_modelo=new javax.swing.table.DefaultTableModel();//Creo el modelo
        jtable_modelo.addColumn("<html><b>Familia</b></html>");
        jtable_modelo.addColumn("<html><b>Sub_fam.</b></html>");
        jtable_modelo.addColumn("<html><b>Id</b></html>");
        jtable_modelo.addColumn("<html><b>Clave</b></html>");
        jtable_modelo.addColumn("<html><b>Descripcion.</b></html>");
        jtable_modelo.addColumn("<html><b>Item.</b></html>");
        jtable_modelo.addColumn("<html><b>Linea</b></html>");
        jtable_modelo.addColumn("<html><b>Costo</b></html>");
        jtable_modelo.addColumn("<html><b>Precio</b></html>");
        jtable_modelo.addColumn("<html><b>F.Ult.C</b></html>");
        jtable_modelo.addColumn("<html><b>Acum V.</b></html>");
        jtable_modelo.addColumn("<html><b>Exis.</b></html>");
        jtable_modelo.addColumn("<html><b>%Rot</b></html>");
    }

private void iniciar_modelo_artipromo()
    {
        jtable_modelo_promoarticulos=new javax.swing.table.DefaultTableModel();//Creo el modelo
        jtable_modelo_promoarticulos.addColumn("<html><b>Familia</b></html>");
        jtable_modelo_promoarticulos.addColumn("<html><b>Sub_fam.</b></html>");
        jtable_modelo_promoarticulos.addColumn("<html><b>Id</b></html>");
        jtable_modelo_promoarticulos.addColumn("<html><b>Clave</b></html>");
        jtable_modelo_promoarticulos.addColumn("<html><b>Descripcion.</b></html>");
        jtable_modelo_promoarticulos.addColumn("<html><b>Item.</b></html>");
        jtable_modelo_promoarticulos.addColumn("<html><b>Linea</b></html>");
        jtable_modelo_promoarticulos.addColumn("<html><b>Costo</b></html>");
        jtable_modelo_promoarticulos.addColumn("<html><b>Precio</b></html>");
        jtable_modelo_promoarticulos.addColumn("<html><b>F.Ult.Compra</b></html>");
        jtable_modelo_promoarticulos.addColumn("<html><b>Acum V.</b></html>");
        jtable_modelo_promoarticulos.addColumn("<html><b>Exis.</b></html>");
        jtable_modelo_promoarticulos.addColumn("<html><b>%Rot</b></html>");
    }
void executabusqueda(int busqueda, int opbusqueda,String textobusca)
 {
    Object[] fnewRow = new Object[13];
        if(this.jcbx_historialne.isSelected()==true)
                        {
                        }
                     else
                        {
                            while(jtable_modelo.getRowCount()>0)jtable_modelo.removeRow(0);
                        }

       DecimalFormat myFormatter = new DecimalFormat("###,###,###.##");
       DecimalFormat myForma = new DecimalFormat("############");
      DecimalFormat myForma2 = new DecimalFormat("############.##");
      float importe=0,importe2=0,acumulado=0,piezas=0,piezas2=0;
     String texto2="",htmlabre="<html><BODY>",htmlcierra="</BODY></html>",colorabre="",colorcierra="";
       String texto="select * from x1sieuno_articulo_catalogov3("+busqueda+","+opbusqueda+",'"+textobusca+"') as (id integer, cla character varying(16),cod character varying(16), des character varying(80), ultimocosto numeric,fa integer,sub integer,it character varying(80),pre numeric, fe date, tei smallint,tev smallint,lineaarti smallint,controalmacen character varying(20),statusarticulo smallint,unidadempaque character varying(8),sublinea smallint,ob character varying(80),nomfa character varying(30), nomsub character varying(50),tementr character varying(25),descriplinea character varying(25),describestatus character varying(25),describesublinea character varying(25),describetemventa character varying(25),idbase character varying(16),descorta character varying(20),exis numeric,acumpzv numeric,acumimport numeric)";
       rs = x.sieuno_executediversosv2(texto,variables_global.getconexiongral());
       try
        {
            while (rs.next())
                {
                  fnewRow[0]=rs.getString ("fa")+":"+rs.getString ("nomfa");
                  fnewRow[1]=rs.getString ("sub")+":"+rs.getString ("nomsub");
                  fnewRow[2]=rs.getString ("id");
                  fnewRow[3]=rs.getString ("cla");
                  fnewRow[4]=rs.getString ("des");
                  fnewRow[5]=rs.getString ("it");
                  fnewRow[6]=rs.getString ("descriplinea");
                  fnewRow[7]=myFormatter.format(rs.getFloat("ultimocosto"));
                  fnewRow[8]=rs.getString ("pre");
                  fnewRow[9]=this.fechaeuropea(rs.getString ("fe"));
                  fnewRow[10]=myForma.format(rs.getFloat("acumpzv"));
                  fnewRow[11]=myForma.format(rs.getFloat("exis"));

                        piezas=rs.getFloat("acumpzv");
                        piezas2=rs.getFloat("exis");
                        acumulado=piezas+piezas2;
                        importe=(piezas/acumulado)*100;
                        colorabre="";
                        colorcierra="";
                        if (importe<=50)
                            {
                                colorabre="<b><font color=#CC0000>";
                                colorcierra="<font></b>";
                            }
                        if ((importe>50) && (importe<=75))
                            {
                                colorabre="<b><font color=#0000FF>";
                                colorcierra="<font></b>";
                            }
                        if (importe>75)
                            {
                                colorabre="<b><font color=#00FF00>";
                                colorcierra="<font></b>";
                            }
                  fnewRow[12]=htmlabre+colorabre+myForma.format(importe)+"%"+colorcierra+htmlcierra;
                  jtable_modelo.addRow(fnewRow);
                }
        }
        catch(Exception e)
        {
            System.out.println(e.getMessage());
        }
       this.registrosobtenidos();
 }
private void creaarticulo_adddetalle_tabla(String temen,String temven,String fa,String subfam,String id,String codigo,String descripcion,String item,String linea,String ultcos,String precio,String feultima,String observa)
    {
    int numeroarticulos=this.jtable_modelo_promoarticulos.getRowCount();
    String codigoactual="";
    float cantidadanterior=0,cantidadactual=0,totalpiezasf=0;
    int encontrado=0;
    float importe=0,importe2=0,acumulado=0,piezas=0,piezas2=0;
    DecimalFormat myForma = new DecimalFormat("###,###,###,###");
    String htmlabre="<html><BODY>",htmlcierra="</BODY></html>",colorabre="",colorcierra="";
    Object[] fnewRow = new Object[13];
    for(int ii=0;ii<numeroarticulos;ii++)
        {
            codigoactual=jtable_modelo_promoarticulos.getValueAt(ii, 3).toString();
            if (codigo.equals(codigoactual))
                {
                    encontrado=1;
                }
        }
        if(encontrado==0)
            {
            //fnewRow[0]=temen;
            //fnewRow[1]=fa;
            //fnewRow[2]=subfam;
            //fnewRow[0]=id;
            //fnewRow[3]=codigo;
            //fnewRow[4]=descripcion;
            //fnewRow[5]=item;
            //fnewRow[6]=precio;
            //fnewRow[7]=feultima;
 //String texto2="select * from x1sieuno_articulo_exist_y_acumventasv2("+opcion+",'0','"+codigo+"') as (id integer, clave_producto character varying(16),cod_barra character varying(16), descripcion character varying(80), ultimo_cos numeric,id_familia integer,id_subfam integer, item character varying(80), precio_1 numeric, fecha_ult_com date, idtempoingreso smallint,idtempoventa smallint,idlinea smallint,nombrefamilia character varying(30),nombresubfamilia character varying(50),nombretemporada character varying(25),nombrelinea character varying(25), existencia double precision,cantidadvendida real,descritemventa character varying(25));";
 //System.out.println(texto2);
                            //try{
                            //rs = x.sieuno_executediversosv2(texto2,variables_global.getconexiongral());
                            //while (rs.next())
                            //{
                                      fnewRow[0]=temen;
                                      fnewRow[1]=temven;
                                      fnewRow[2]=fa;
                                      fnewRow[3]=subfam;
                                      fnewRow[4]=id;
                                      fnewRow[5]=codigo;
                                      fnewRow[6]=descripcion;
                                      fnewRow[7]=item;
                                      fnewRow[8]=linea;
                                      fnewRow[9]=ultcos;
                                      fnewRow[10]=precio;
                                      fnewRow[11]=feultima;
                                      fnewRow[12]=observa;
                                      jtable_modelo_promoarticulos.addRow(fnewRow);
                             //}//consulto la bd
                             //}
                             //catch(Exception e)
                             //{
                                //System.out.println(e.getMessage());
                             //}

            //jtable_modelo_promoarticulos.addRow(fnewRow);

            }
   }

 private String  fechaeuropea(String fecha) {

         //resibe cadena de fecha en formato americano yyyy-MM-dd
        java.util.Date fechaestaeuropa=null;
       SimpleDateFormat formateadorestaeuropa = new SimpleDateFormat("dd-MM-yyyy");
       String cadenafecha="";
        try
         {
          fechaestaeuropa = formateadoresta.parse(fecha);
         }
        catch (ParseException e)
          {
             //Error, la cadena de texto no se puede convertir en fecha.
          }
       cadenafecha= formateadorestaeuropa.format(fechaestaeuropa);
       return cadenafecha;

    }
private void dioclick(java.awt.event.MouseEvent evt) {
        // TODO add your handling code here:
         System.out.println("dio doble  click");
         int fila = jtb_catalogo_articulos.getSelectedRow();
         String vtementrada = jtb_catalogo_articulos.getValueAt(fila, 0).toString();
         String vtemven = jtb_catalogo_articulos.getValueAt(fila, 1).toString();
         String vfa = jtb_catalogo_articulos.getValueAt(fila, 2).toString();
         String vsubfam = jtb_catalogo_articulos.getValueAt(fila, 3).toString();
         String vid = jtb_catalogo_articulos.getValueAt(fila, 4).toString();
         String vcodigo = jtb_catalogo_articulos.getValueAt(fila, 5).toString();
         String vdescripcion = jtb_catalogo_articulos.getValueAt(fila, 6).toString();
         String vitem = jtb_catalogo_articulos.getValueAt(fila, 7).toString();
         String vlinea = jtb_catalogo_articulos.getValueAt(fila, 8).toString();
         String vcosto = jtb_catalogo_articulos.getValueAt(fila, 9).toString();
         String vprecio = jtb_catalogo_articulos.getValueAt(fila, 10).toString();
         String vfeultima = jtb_catalogo_articulos.getValueAt(fila, 11).toString();
         String vobserv = jtb_catalogo_articulos.getValueAt(fila, 12).toString()+".";
         this.creaarticulo_adddetalle_tabla(vtementrada,vtemven,vfa,vsubfam,vid,vcodigo,vdescripcion,vitem,vlinea,vcosto,vprecio,vfeultima,vobserv);
    }

private void dioclickedita(java.awt.event.MouseEvent evt) {
        // TODO add your handling code here:
         System.out.println("dio doble  click");
         int fila = jt_articulosapromo.getSelectedRow();
         String valor = jt_articulosapromo.getValueAt(fila, 4).toString();

        //JFrame mainFrame = Sie_invdisApp.getApplication().getMainFrame();
        articulos_sie_editar fase=new articulos_sie_editar(valor);
        fase.pack();
        fase.setVisible(true);
        //setVisible(false);
    }
private void jtb_catalogo_articulosMouseClicked(java.awt.event.MouseEvent evt) {
        // TODO add your handling code here:
    }
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        buttonGroup1 = new javax.swing.ButtonGroup();
        buttonGroup2 = new javax.swing.ButtonGroup();
        jPanel1 = new javax.swing.JPanel();
        jrb_bclave = new javax.swing.JRadioButton();
        jrb_bdescrip = new javax.swing.JRadioButton();
        jtf_busqueda = new javax.swing.JTextField();
        jbtn_buscar = new javax.swing.JButton();
        jrb_bitem = new javax.swing.JRadioButton();
        jrb_bprecio = new javax.swing.JRadioButton();
        jrb_obexacto = new javax.swing.JRadioButton();
        jrb_obcomienza = new javax.swing.JRadioButton();
        jrb_obaniway = new javax.swing.JRadioButton();
        jrb_bidfam = new javax.swing.JRadioButton();
        jrb_bidsubfam = new javax.swing.JRadioButton();
        jrb_bdessubfam = new javax.swing.JRadioButton();
        jScrollPane4 = new javax.swing.JScrollPane();
        jta_archivo = new javax.swing.JTextArea();
        jcbx_historialne = new javax.swing.JCheckBox();
        jrb_bclave1 = new javax.swing.JRadioButton();
        jPanel3 = new javax.swing.JPanel();
        jScrollPane1 = new javax.swing.JScrollPane();
        jtb_catalogo_articulos = new javax.swing.JTable(){
            public boolean isCellEditable(int rowIndex, int mColIndex) {
                return false;
            }}
            ;
            jbtn_agregar = new javax.swing.JButton();
            jLabel6 = new javax.swing.JLabel();
            jLabel7 = new javax.swing.JLabel();
            jlbl_cantidadregistros = new javax.swing.JLabel();
            jLabel8 = new javax.swing.JLabel();
            jlbl_textobuscado = new javax.swing.JLabel();
            jcbx_historialne1 = new javax.swing.JCheckBox();
            jPanel2 = new javax.swing.JPanel();
            jScrollPane2 = new javax.swing.JScrollPane();
            jt_articulosapromo = new javax.swing.JTable()
            {
                public boolean isCellEditable(int rowIndex, int mColIndex) {
                    return false;
                }}
                ;
                jPanel5 = new javax.swing.JPanel();
                jLabel1 = new javax.swing.JLabel();
                jtf_describe = new javax.swing.JTextField();
                jLabel2 = new javax.swing.JLabel();
                jdc_fechaprogramada = new com.toedter.calendar.JDateChooser();
                jdc_rangofinal = new com.toedter.calendar.JDateChooser();
                jLabel4 = new javax.swing.JLabel();
                jdc_rangoini = new com.toedter.calendar.JDateChooser();
                jLabel3 = new javax.swing.JLabel();
                jLabel5 = new javax.swing.JLabel();
                jtf_observaindica = new javax.swing.JTextField();
                jbtn_guardasolicitud = new javax.swing.JButton();
                jLabel9 = new javax.swing.JLabel();
                jdc_fechaaplica = new com.toedter.calendar.JDateChooser();
                jLabel10 = new javax.swing.JLabel();
                jdc_fecharevision = new com.toedter.calendar.JDateChooser();
                jlbl_status = new javax.swing.JLabel();
                jcmbx_status = new javax.swing.JComboBox();
                jMenuBar1 = new javax.swing.JMenuBar();
                jMenu1 = new javax.swing.JMenu();
                jmni_salir = new javax.swing.JMenuItem();
                jMenu2 = new javax.swing.JMenu();
                jmni_escape = new javax.swing.JMenuItem();
                jMenuItem1 = new javax.swing.JMenuItem();
                jMenu3 = new javax.swing.JMenu();

                setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
                org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(sie_invdis.Sie_invdisApp.class).getContext().getResourceMap(articulos_sie_promociones_alta.class);
                setTitle(resourceMap.getString("Form.title")); // NOI18N
                setName("Form"); // NOI18N

                jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder(resourceMap.getString("jPanel1.border.title"))); // NOI18N
                jPanel1.setName("jPanel1"); // NOI18N

                buttonGroup2.add(jrb_bclave);
                jrb_bclave.setText(resourceMap.getString("jrb_bclave.text")); // NOI18N
                jrb_bclave.setToolTipText(resourceMap.getString("jrb_bclave.toolTipText")); // NOI18N
                jrb_bclave.setActionCommand(resourceMap.getString("jrb_bclave.actionCommand")); // NOI18N
                jrb_bclave.setName("jrb_bclave"); // NOI18N
                jrb_bclave.addActionListener(new java.awt.event.ActionListener() {
                    public void actionPerformed(java.awt.event.ActionEvent evt) {
                        jrb_bclaveActionPerformed(evt);
                    }
                });

                buttonGroup2.add(jrb_bdescrip);
                jrb_bdescrip.setText(resourceMap.getString("jrb_bdescrip.text")); // NOI18N
                jrb_bdescrip.setToolTipText(resourceMap.getString("jrb_bdescrip.toolTipText")); // NOI18N
                jrb_bdescrip.setActionCommand(resourceMap.getString("jrb_bdescrip.actionCommand")); // NOI18N
                jrb_bdescrip.setName("jrb_bdescrip"); // NOI18N
                jrb_bdescrip.addActionListener(new java.awt.event.ActionListener() {
                    public void actionPerformed(java.awt.event.ActionEvent evt) {
                        jrb_bdescripActionPerformed(evt);
                    }
                });

                jtf_busqueda.setToolTipText(resourceMap.getString("jtf_busqueda.toolTipText")); // NOI18N
                jtf_busqueda.setName("jtf_busqueda"); // NOI18N
                jtf_busqueda.addActionListener(new java.awt.event.ActionListener() {
                    public void actionPerformed(java.awt.event.ActionEvent evt) {
                        jtf_busquedaActionPerformed(evt);
                    }
                });

                jbtn_buscar.setIcon(resourceMap.getIcon("jbtn_buscar.icon")); // NOI18N
                jbtn_buscar.setText(resourceMap.getString("jbtn_buscar.text")); // NOI18N
                jbtn_buscar.setName("jbtn_buscar"); // NOI18N
                jbtn_buscar.addActionListener(new java.awt.event.ActionListener() {
                    public void actionPerformed(java.awt.event.ActionEvent evt) {
                        jbtn_buscarActionPerformed(evt);
                    }
                });

                buttonGroup2.add(jrb_bitem);
                jrb_bitem.setText(resourceMap.getString("jrb_bitem.text")); // NOI18N
                jrb_bitem.setToolTipText(resourceMap.getString("jrb_bitem.toolTipText")); // NOI18N
                jrb_bitem.setActionCommand(resourceMap.getString("jrb_bitem.actionCommand")); // NOI18N
                jrb_bitem.setName("jrb_bitem"); // NOI18N
                jrb_bitem.addActionListener(new java.awt.event.ActionListener() {
                    public void actionPerformed(java.awt.event.ActionEvent evt) {
                        jrb_bitemActionPerformed(evt);
                    }
                });

                buttonGroup2.add(jrb_bprecio);
                jrb_bprecio.setText(resourceMap.getString("jrb_bprecio.text")); // NOI18N
                jrb_bprecio.setToolTipText(resourceMap.getString("jrb_bprecio.toolTipText")); // NOI18N
                jrb_bprecio.setActionCommand(resourceMap.getString("jrb_bprecio.actionCommand")); // NOI18N
                jrb_bprecio.setName("jrb_bprecio"); // NOI18N
                jrb_bprecio.addActionListener(new java.awt.event.ActionListener() {
                    public void actionPerformed(java.awt.event.ActionEvent evt) {
                        jrb_bprecioActionPerformed(evt);
                    }
                });

                buttonGroup1.add(jrb_obexacto);
                jrb_obexacto.setText(resourceMap.getString("jrb_obexacto.text")); // NOI18N
                jrb_obexacto.setToolTipText(resourceMap.getString("jrb_obexacto.toolTipText")); // NOI18N
                jrb_obexacto.setActionCommand(resourceMap.getString("jrb_obexacto.actionCommand")); // NOI18N
                jrb_obexacto.setName("jrb_obexacto"); // NOI18N
                jrb_obexacto.addActionListener(new java.awt.event.ActionListener() {
                    public void actionPerformed(java.awt.event.ActionEvent evt) {
                        jrb_obexactoActionPerformed(evt);
                    }
                });

                buttonGroup1.add(jrb_obcomienza);
                jrb_obcomienza.setText(resourceMap.getString("jrb_obcomienza.text")); // NOI18N
                jrb_obcomienza.setToolTipText(resourceMap.getString("jrb_obcomienza.toolTipText")); // NOI18N
                jrb_obcomienza.setActionCommand(resourceMap.getString("jrb_obcomienza.actionCommand")); // NOI18N
                jrb_obcomienza.setName("jrb_obcomienza"); // NOI18N
                jrb_obcomienza.addActionListener(new java.awt.event.ActionListener() {
                    public void actionPerformed(java.awt.event.ActionEvent evt) {
                        jrb_obcomienzaActionPerformed(evt);
                    }
                });

                buttonGroup1.add(jrb_obaniway);
                jrb_obaniway.setText(resourceMap.getString("jrb_obaniway.text")); // NOI18N
                jrb_obaniway.setToolTipText(resourceMap.getString("jrb_obaniway.toolTipText")); // NOI18N
                jrb_obaniway.setActionCommand(resourceMap.getString("jrb_obaniway.actionCommand")); // NOI18N
                jrb_obaniway.setName("jrb_obaniway"); // NOI18N
                jrb_obaniway.addActionListener(new java.awt.event.ActionListener() {
                    public void actionPerformed(java.awt.event.ActionEvent evt) {
                        jrb_obaniwayActionPerformed(evt);
                    }
                });

                buttonGroup2.add(jrb_bidfam);
                jrb_bidfam.setText(resourceMap.getString("jrb_bidfam.text")); // NOI18N
                jrb_bidfam.setToolTipText(resourceMap.getString("jrb_bidfam.toolTipText")); // NOI18N
                jrb_bidfam.setActionCommand(resourceMap.getString("jrb_bidfam.actionCommand")); // NOI18N
                jrb_bidfam.setName("jrb_bidfam"); // NOI18N
                jrb_bidfam.addActionListener(new java.awt.event.ActionListener() {
                    public void actionPerformed(java.awt.event.ActionEvent evt) {
                        jrb_bidfamActionPerformed(evt);
                    }
                });

                buttonGroup2.add(jrb_bidsubfam);
                jrb_bidsubfam.setText(resourceMap.getString("jrb_bidsubfam.text")); // NOI18N
                jrb_bidsubfam.setToolTipText(resourceMap.getString("jrb_bidsubfam.toolTipText")); // NOI18N
                jrb_bidsubfam.setActionCommand(resourceMap.getString("jrb_bidsubfam.actionCommand")); // NOI18N
                jrb_bidsubfam.setName("jrb_bidsubfam"); // NOI18N
                jrb_bidsubfam.addActionListener(new java.awt.event.ActionListener() {
                    public void actionPerformed(java.awt.event.ActionEvent evt) {
                        jrb_bidsubfamActionPerformed(evt);
                    }
                });

                buttonGroup2.add(jrb_bdessubfam);
                jrb_bdessubfam.setText(resourceMap.getString("jrb_bdessubfam.text")); // NOI18N
                jrb_bdessubfam.setToolTipText(resourceMap.getString("jrb_bdessubfam.toolTipText")); // NOI18N
                jrb_bdessubfam.setActionCommand(resourceMap.getString("jrb_bdessubfam.actionCommand")); // NOI18N
                jrb_bdessubfam.setName("jrb_bdessubfam"); // NOI18N
                jrb_bdessubfam.addActionListener(new java.awt.event.ActionListener() {
                    public void actionPerformed(java.awt.event.ActionEvent evt) {
                        jrb_bdessubfamActionPerformed(evt);
                    }
                });

                jScrollPane4.setName("jScrollPane4"); // NOI18N

                jta_archivo.setColumns(20);
                jta_archivo.setRows(5);
                jta_archivo.setName("jta_archivo"); // NOI18N
                jScrollPane4.setViewportView(jta_archivo);

                jcbx_historialne.setText(resourceMap.getString("jcbx_historialne.text")); // NOI18N
                jcbx_historialne.setName("jcbx_historialne"); // NOI18N
                jcbx_historialne.addActionListener(new java.awt.event.ActionListener() {
                    public void actionPerformed(java.awt.event.ActionEvent evt) {
                        jcbx_historialneActionPerformed(evt);
                    }
                });

                buttonGroup2.add(jrb_bclave1);
                jrb_bclave1.setText(resourceMap.getString("jrb_bclave1.text")); // NOI18N
                jrb_bclave1.setToolTipText(resourceMap.getString("jrb_bclave1.toolTipText")); // NOI18N
                jrb_bclave1.setActionCommand(resourceMap.getString("jrb_bclave1.actionCommand")); // NOI18N
                jrb_bclave1.setName("jrb_bclave1"); // NOI18N
                jrb_bclave1.addActionListener(new java.awt.event.ActionListener() {
                    public void actionPerformed(java.awt.event.ActionEvent evt) {
                        jrb_bclave1ActionPerformed(evt);
                    }
                });

                javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
                jPanel1.setLayout(jPanel1Layout);
                jPanel1Layout.setHorizontalGroup(
                    jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addGroup(jPanel1Layout.createSequentialGroup()
                                .addComponent(jcbx_historialne)
                                .addGap(125, 125, 125))
                            .addGroup(jPanel1Layout.createSequentialGroup()
                                .addComponent(jrb_bclave1)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)))
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel1Layout.createSequentialGroup()
                                .addComponent(jrb_obexacto)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jrb_obcomienza)
                                .addGap(1, 1, 1)
                                .addComponent(jrb_obaniway))
                            .addGroup(jPanel1Layout.createSequentialGroup()
                                .addGap(244, 244, 244)
                                .addComponent(jtf_busqueda, javax.swing.GroupLayout.PREFERRED_SIZE, 129, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jbtn_buscar))
                            .addGroup(jPanel1Layout.createSequentialGroup()
                                .addComponent(jrb_bclave)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(jrb_bdescrip)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(jrb_bitem)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jrb_bidsubfam)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jrb_bprecio)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(jrb_bidfam)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jrb_bdessubfam)))
                        .addGap(18, 18, 18)
                        .addComponent(jScrollPane4, javax.swing.GroupLayout.PREFERRED_SIZE, 200, javax.swing.GroupLayout.PREFERRED_SIZE))
                );
                jPanel1Layout.setVerticalGroup(
                    jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel1Layout.createSequentialGroup()
                                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(jrb_obexacto)
                                    .addComponent(jrb_obcomienza)
                                    .addComponent(jrb_obaniway)
                                    .addComponent(jtf_busqueda, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(jbtn_buscar)
                                    .addComponent(jcbx_historialne))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(jrb_bclave)
                                    .addComponent(jrb_bdescrip)
                                    .addComponent(jrb_bitem)
                                    .addComponent(jrb_bidsubfam)
                                    .addComponent(jrb_bprecio)
                                    .addComponent(jrb_bidfam)
                                    .addComponent(jrb_bdessubfam)
                                    .addComponent(jrb_bclave1)))
                            .addComponent(jScrollPane4, javax.swing.GroupLayout.DEFAULT_SIZE, 50, Short.MAX_VALUE))
                        .addContainerGap())
                );

                jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder(resourceMap.getString("jPanel3.border.title"))); // NOI18N
                jPanel3.setName("jPanel3"); // NOI18N

                jScrollPane1.setName("jScrollPane1"); // NOI18N

                jtb_catalogo_articulos.setModel(this.jtable_modelo);
                jtb_catalogo_articulos.setName("jtb_catalogo_articulos"); // NOI18N
                jtb_catalogo_articulos.addMouseListener(new java.awt.event.MouseAdapter() {
                    public void mouseClicked(java.awt.event.MouseEvent evt) {
                        jtb_catalogo_articulosMouseClicked(evt);
                        if(evt.getClickCount() >= 2)
                        {
                            dioclick(evt);
                            //System.out.println(" double click" );

                        }
                    }
                });
                jScrollPane1.setViewportView(jtb_catalogo_articulos);

                jbtn_agregar.setIcon(resourceMap.getIcon("jbtn_agregar.icon")); // NOI18N
                jbtn_agregar.setText(resourceMap.getString("jbtn_agregar.text")); // NOI18N
                jbtn_agregar.setName("jbtn_agregar"); // NOI18N
                jbtn_agregar.addActionListener(new java.awt.event.ActionListener() {
                    public void actionPerformed(java.awt.event.ActionEvent evt) {
                        jbtn_agregarActionPerformed(evt);
                    }
                });

                jLabel6.setText(resourceMap.getString("jLabel6.text")); // NOI18N
                jLabel6.setName("jLabel6"); // NOI18N

                jLabel7.setFont(resourceMap.getFont("jLabel7.font")); // NOI18N
                jLabel7.setText(resourceMap.getString("jLabel7.text")); // NOI18N
                jLabel7.setName("jLabel7"); // NOI18N

                jlbl_cantidadregistros.setFont(resourceMap.getFont("jlbl_cantidadregistros.font")); // NOI18N
                jlbl_cantidadregistros.setText(resourceMap.getString("jlbl_cantidadregistros.text")); // NOI18N
                jlbl_cantidadregistros.setName("jlbl_cantidadregistros"); // NOI18N

                jLabel8.setFont(resourceMap.getFont("jLabel8.font")); // NOI18N
                jLabel8.setText(resourceMap.getString("jLabel8.text")); // NOI18N
                jLabel8.setName("jLabel8"); // NOI18N

                jlbl_textobuscado.setText(resourceMap.getString("jlbl_textobuscado.text")); // NOI18N
                jlbl_textobuscado.setName("jlbl_textobuscado"); // NOI18N

                jcbx_historialne1.setText(resourceMap.getString("jcbx_historialne1.text")); // NOI18N
                jcbx_historialne1.setName("jcbx_historialne1"); // NOI18N
                jcbx_historialne1.addActionListener(new java.awt.event.ActionListener() {
                    public void actionPerformed(java.awt.event.ActionEvent evt) {
                        jcbx_historialne1ActionPerformed(evt);
                    }
                });

                javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
                jPanel3.setLayout(jPanel3Layout);
                jPanel3Layout.setHorizontalGroup(
                    jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup()
                        .addComponent(jLabel6)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jlbl_textobuscado, javax.swing.GroupLayout.PREFERRED_SIZE, 58, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabel7)
                        .addGap(18, 18, 18)
                        .addComponent(jlbl_cantidadregistros, javax.swing.GroupLayout.PREFERRED_SIZE, 39, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabel8)
                        .addGap(117, 117, 117)
                        .addComponent(jcbx_historialne1)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 311, Short.MAX_VALUE)
                        .addComponent(jbtn_agregar))
                    .addGroup(jPanel3Layout.createSequentialGroup()
                        .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 401, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addContainerGap(532, Short.MAX_VALUE))
                );
                jPanel3Layout.setVerticalGroup(
                    jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup()
                        .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 180, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jbtn_agregar)
                            .addComponent(jLabel8)
                            .addComponent(jlbl_cantidadregistros)
                            .addComponent(jLabel7)
                            .addComponent(jLabel6)
                            .addComponent(jlbl_textobuscado)
                            .addComponent(jcbx_historialne1)))
                );

                jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder(resourceMap.getString("jPanel2.border.title"))); // NOI18N
                jPanel2.setName("jPanel2"); // NOI18N

                jScrollPane2.setName("jScrollPane2"); // NOI18N

                jt_articulosapromo.setModel(this.jtable_modelo_promoarticulos);
                jt_articulosapromo.setName("jt_articulosapromo"); // NOI18N
                jt_articulosapromo.addMouseListener(new java.awt.event.MouseAdapter() {
                    public void mouseClicked(java.awt.event.MouseEvent evt) {
                        jt_articulosapromoMouseClicked(evt);
                        if(evt.getClickCount() >= 2)
                        {
                            dioclickedita(evt);
                            //System.out.println(" double click" );

                        }
                    }
                });
                jScrollPane2.setViewportView(jt_articulosapromo);

                javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
                jPanel2.setLayout(jPanel2Layout);
                jPanel2Layout.setHorizontalGroup(
                    jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 923, Short.MAX_VALUE)
                );
                jPanel2Layout.setVerticalGroup(
                    jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jScrollPane2, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 169, Short.MAX_VALUE)
                );

                jPanel5.setBorder(javax.swing.BorderFactory.createTitledBorder(resourceMap.getString("jPanel5.border.title"))); // NOI18N
                jPanel5.setName("jPanel5"); // NOI18N

                jLabel1.setText(resourceMap.getString("jLabel1.text")); // NOI18N
                jLabel1.setName("jLabel1"); // NOI18N

                jtf_describe.setToolTipText(resourceMap.getString("jtf_describe.toolTipText")); // NOI18N
                jtf_describe.setName("jtf_describe"); // NOI18N

                jLabel2.setText(resourceMap.getString("jLabel2.text")); // NOI18N
                jLabel2.setName("jLabel2"); // NOI18N

                jdc_fechaprogramada.setDateFormatString(resourceMap.getString("jdc_fechaprogramada.dateFormatString")); // NOI18N
                jdc_fechaprogramada.setName("jdc_fechaprogramada"); // NOI18N

                jdc_rangofinal.setDateFormatString(resourceMap.getString("jdc_rangofinal.dateFormatString")); // NOI18N
                jdc_rangofinal.setName("jdc_rangofinal"); // NOI18N

                jLabel4.setText(resourceMap.getString("jLabel4.text")); // NOI18N
                jLabel4.setName("jLabel4"); // NOI18N

                jdc_rangoini.setDateFormatString(resourceMap.getString("jdc_rangoini.dateFormatString")); // NOI18N
                jdc_rangoini.setName("jdc_rangoini"); // NOI18N

                jLabel3.setText(resourceMap.getString("jLabel3.text")); // NOI18N
                jLabel3.setName("jLabel3"); // NOI18N

                jLabel5.setText(resourceMap.getString("jLabel5.text")); // NOI18N
                jLabel5.setName("jLabel5"); // NOI18N

                jtf_observaindica.setName("jtf_observaindica"); // NOI18N

                jbtn_guardasolicitud.setIcon(resourceMap.getIcon("jbtn_guardasolicitud.icon")); // NOI18N
                jbtn_guardasolicitud.setText(resourceMap.getString("jbtn_guardasolicitud.text")); // NOI18N
                jbtn_guardasolicitud.setToolTipText(resourceMap.getString("jbtn_guardasolicitud.toolTipText")); // NOI18N
                jbtn_guardasolicitud.setName("jbtn_guardasolicitud"); // NOI18N
                jbtn_guardasolicitud.addActionListener(new java.awt.event.ActionListener() {
                    public void actionPerformed(java.awt.event.ActionEvent evt) {
                        jbtn_guardasolicitudActionPerformed(evt);
                    }
                });

                jLabel9.setText(resourceMap.getString("jLabel9.text")); // NOI18N
                jLabel9.setName("jLabel9"); // NOI18N

                jdc_fechaaplica.setDateFormatString(resourceMap.getString("jdc_fechaaplica.dateFormatString")); // NOI18N
                jdc_fechaaplica.setName("jdc_fechaaplica"); // NOI18N

                jLabel10.setText(resourceMap.getString("jLabel10.text")); // NOI18N
                jLabel10.setName("jLabel10"); // NOI18N

                jdc_fecharevision.setDateFormatString(resourceMap.getString("jdc_fecharevision.dateFormatString")); // NOI18N
                jdc_fecharevision.setName("jdc_fecharevision"); // NOI18N

                jlbl_status.setText(resourceMap.getString("jlbl_status.text")); // NOI18N
                jlbl_status.setName("jlbl_status"); // NOI18N

                jcmbx_status.setName("jcmbx_status"); // NOI18N

                javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5);
                jPanel5.setLayout(jPanel5Layout);
                jPanel5Layout.setHorizontalGroup(
                    jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel5Layout.createSequentialGroup()
                        .addContainerGap()
                        .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel5Layout.createSequentialGroup()
                                .addComponent(jLabel10)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jdc_fecharevision, javax.swing.GroupLayout.PREFERRED_SIZE, 129, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jLabel3)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jdc_rangoini, javax.swing.GroupLayout.PREFERRED_SIZE, 114, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jLabel4)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jdc_rangofinal, javax.swing.GroupLayout.PREFERRED_SIZE, 119, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(jLabel5)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(jtf_observaindica, javax.swing.GroupLayout.DEFAULT_SIZE, 201, Short.MAX_VALUE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 8, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(jbtn_guardasolicitud, javax.swing.GroupLayout.PREFERRED_SIZE, 96, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel5Layout.createSequentialGroup()
                                .addComponent(jlbl_status)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jcmbx_status, 0, 125, Short.MAX_VALUE)
                                .addGap(92, 92, 92)
                                .addComponent(jLabel1)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jtf_describe, javax.swing.GroupLayout.PREFERRED_SIZE, 179, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(jLabel9)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(jdc_fechaaplica, javax.swing.GroupLayout.PREFERRED_SIZE, 129, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(jLabel2)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(jdc_fechaprogramada, javax.swing.GroupLayout.PREFERRED_SIZE, 129, javax.swing.GroupLayout.PREFERRED_SIZE))))
                );
                jPanel5Layout.setVerticalGroup(
                    jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel5Layout.createSequentialGroup()
                        .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(jLabel1)
                                    .addComponent(jtf_describe, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(jlbl_status)
                                    .addComponent(jcmbx_status, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jLabel9, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(jdc_fechaaplica, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                            .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jdc_fechaprogramada, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(jbtn_guardasolicitud)
                                .addComponent(jLabel5)
                                .addComponent(jtf_observaindica, javax.swing.GroupLayout.PREFERRED_SIZE, 22, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addComponent(jLabel10, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                .addComponent(jdc_fecharevision, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jLabel3)
                                    .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                        .addComponent(jdc_rangoini, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                            .addComponent(jdc_rangofinal, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                            .addComponent(jLabel4))))))
                        .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                );

                jMenuBar1.setName("jMenuBar1"); // NOI18N

                jMenu1.setText(resourceMap.getString("jMenu1.text")); // NOI18N
                jMenu1.setName("jMenu1"); // NOI18N

                jmni_salir.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_S, java.awt.event.InputEvent.ALT_MASK));
                jmni_salir.setText(resourceMap.getString("jmni_salir.text")); // NOI18N
                jmni_salir.setName("jmni_salir"); // NOI18N
                jmni_salir.addActionListener(new java.awt.event.ActionListener() {
                    public void actionPerformed(java.awt.event.ActionEvent evt) {
                        jmni_salirActionPerformed(evt);
                    }
                });
                jMenu1.add(jmni_salir);

                jMenuBar1.add(jMenu1);

                jMenu2.setText(resourceMap.getString("jMenu2.text")); // NOI18N
                jMenu2.setName("jMenu2"); // NOI18N

                jmni_escape.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_ESCAPE, 0));
                jmni_escape.setText(resourceMap.getString("jmni_escape.text")); // NOI18N
                jmni_escape.setName("jmni_escape"); // NOI18N
                jmni_escape.addActionListener(new java.awt.event.ActionListener() {
                    public void actionPerformed(java.awt.event.ActionEvent evt) {
                        jmni_escapeActionPerformed(evt);
                    }
                });
                jMenu2.add(jmni_escape);

                jMenuItem1.setText(resourceMap.getString("jMenuItem1.text")); // NOI18N
                jMenuItem1.setName("jMenuItem1"); // NOI18N
                jMenuItem1.addActionListener(new java.awt.event.ActionListener() {
                    public void actionPerformed(java.awt.event.ActionEvent evt) {
                        jMenuItem1ActionPerformed(evt);
                    }
                });
                jMenu2.add(jMenuItem1);

                jMenuBar1.add(jMenu2);

                jMenu3.setText(resourceMap.getString("jMenu3.text")); // NOI18N
                jMenu3.setName("jMenu3"); // NOI18N
                jMenuBar1.add(jMenu3);

                setJMenuBar(jMenuBar1);

                javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
                getContentPane().setLayout(layout);
                layout.setHorizontalGroup(
                    layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jPanel3, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jPanel5, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addContainerGap())
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addContainerGap(28, Short.MAX_VALUE))
                );
                layout.setVerticalGroup(
                    layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, 76, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jPanel5, javax.swing.GroupLayout.PREFERRED_SIZE, 82, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addContainerGap())
                );

                pack();
            }// </editor-fold>//GEN-END:initComponents

    private void jmni_salirActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jmni_salirActionPerformed
        // TODO add your handling code here:
        if(JOptionPane.showConfirmDialog(null, "Desea Salir?")==0)
            {
                this.dispose();
            }
    }//GEN-LAST:event_jmni_salirActionPerformed

    private void jmni_escapeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jmni_escapeActionPerformed
        // TODO add your handling code here:
        this.jmni_salirActionPerformed(evt);
    }//GEN-LAST:event_jmni_escapeActionPerformed

    private void jrb_bclaveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jrb_bclaveActionPerformed
        // TODO add your handling code here:

        buscamp=Integer.parseInt(evt.getActionCommand().toString());
}//GEN-LAST:event_jrb_bclaveActionPerformed

    private void jrb_bdescripActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jrb_bdescripActionPerformed
        // TODO add your handling code here:
        buscamp=Integer.parseInt(evt.getActionCommand().toString());
}//GEN-LAST:event_jrb_bdescripActionPerformed

    private void jtf_busquedaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jtf_busquedaActionPerformed
        // TODO add your handling code here:
        this.jbtn_buscarActionPerformed(evt);
}//GEN-LAST:event_jtf_busquedaActionPerformed

    private void jbtn_buscarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtn_buscarActionPerformed
        // TODO add your handling code here:
        // this.jtf_busqueda.getText();
        if(JOptionPane.showConfirmDialog(null, "Estan Correctos sus Datos?")==0) {
            this.executabusqueda(buscamp,opbuscamp,this.jtf_busqueda.getText().trim().toUpperCase());
        } else {
            this.jtf_busqueda.requestFocus();
        }

    }//GEN-LAST:event_jbtn_buscarActionPerformed

    private void jrb_bitemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jrb_bitemActionPerformed
        // TODO add your handling code here:
        buscamp=Integer.parseInt(evt.getActionCommand().toString());
}//GEN-LAST:event_jrb_bitemActionPerformed

    private void jrb_bprecioActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jrb_bprecioActionPerformed
        // TODO add your handling code here:
        buscamp=Integer.parseInt(evt.getActionCommand().toString());
}//GEN-LAST:event_jrb_bprecioActionPerformed

    private void jrb_obexactoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jrb_obexactoActionPerformed
        // TODO add your handling code here:
        opbuscamp=Integer.parseInt(evt.getActionCommand().toString());
}//GEN-LAST:event_jrb_obexactoActionPerformed

    private void jrb_obcomienzaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jrb_obcomienzaActionPerformed
        // TODO add your handling code here:
        opbuscamp=Integer.parseInt(evt.getActionCommand().toString());
}//GEN-LAST:event_jrb_obcomienzaActionPerformed

    private void jrb_obaniwayActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jrb_obaniwayActionPerformed
        // TODO add your handling code here:
        opbuscamp=Integer.parseInt(evt.getActionCommand().toString());
}//GEN-LAST:event_jrb_obaniwayActionPerformed

    private void jrb_bidfamActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jrb_bidfamActionPerformed
        // TODO add your handling code here:
        buscamp=Integer.parseInt(evt.getActionCommand().toString());
}//GEN-LAST:event_jrb_bidfamActionPerformed

    private void jrb_bidsubfamActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jrb_bidsubfamActionPerformed
        // TODO add your handling code here:
        buscamp=Integer.parseInt(evt.getActionCommand().toString());
}//GEN-LAST:event_jrb_bidsubfamActionPerformed

    private void jrb_bdessubfamActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jrb_bdessubfamActionPerformed
        // TODO add your handling code here:
        buscamp=Integer.parseInt(evt.getActionCommand().toString());
}//GEN-LAST:event_jrb_bdessubfamActionPerformed

    private void jbtn_guardasolicitudActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtn_guardasolicitudActionPerformed
        // TODO add your handling code here:

         String arreglo_status[]=this.jcmbx_status.getSelectedItem().toString().split(":");

        if(JOptionPane.showConfirmDialog(null, "Desea Guardar Promocion. Estan correcto sus Datos?")==0)
                    {
                       //this.quitardescripcion();
                        this.ponerpunto();
                        String selectin="";
                        for(int ii=0;ii<this.jtable_modelo_promoarticulos.getRowCount();ii++)
                            {
                                if (ii>0)
                                    {
                                        selectin+=".";
                                    }
                                selectin+=""+jtable_modelo_promoarticulos.getValueAt(ii ,3)+"";
                            }
                        String texto="select * from x1sieuno_articulo_promociones_insertv3('"+this.fechaamericana(this.jdc_fechaprogramada.getDate())+"','"+this.fechaamericana(this.jdc_fechaaplica.getDate())+"','"+this.fechaamericana(this.jdc_fecharevision.getDate())+"','"+this.fechaamericana(this.jdc_rangoini.getDate())+"','"+this.fechaamericana(this.jdc_rangofinal.getDate())+"','"+this.jtf_describe.getText()+"','"+this.jtf_observaindica.getText()+"','"+arreglo_status[0]+"','"+variables_global.getId_empleado()+"','"+selectin+"')";
                        System.out.println(texto);

                            try
                                {
                                //rs=x.sieuno_executediversosv2(texto,variables_global.getconexiongral());
                                while (rs.next())
                                    {                                        
                                        if (rs.getInt(1) > 0)
                                                {
                                                    JOptionPane.showMessageDialog(null,"Promocion Guardada, Gracias", "Sistema Integral(Alta Promociones) : Confirmacion",1);
                                                }
                                            else
                                                {
                                                    JOptionPane.showMessageDialog(null,"Promocion Guardada Error", "Sistema Integral(Alta Promociones) : Error",1);
                                                }
                                    }
                                }
                            catch(Exception e)
                                   {
                                        System.out.println(e.getMessage());
                                        JOptionPane.showMessageDialog(null," Promocion Incorrecta ", "Sistema Integral(Promociones) : Error",1);
                                   }
                }//fin del if qu confirmo guardar diferencia
}//GEN-LAST:event_jbtn_guardasolicitudActionPerformed

    private void jbtn_agregarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtn_agregarActionPerformed
        // TODO add your handling code here:
        int totalfilasreporte=this.jtb_catalogo_articulos.getRowCount(),i=0;
    if(JOptionPane.showConfirmDialog(null, "Desea Agregar Todos?")==0)
        {
        for(i=0;i<totalfilasreporte;i++)
                    {
                         String vtementrada = jtb_catalogo_articulos.getValueAt(i, 0).toString();
                         String vtemven = jtb_catalogo_articulos.getValueAt(i, 1).toString();
                         String vfa = jtb_catalogo_articulos.getValueAt(i, 2).toString();
                         String vsubfam = jtb_catalogo_articulos.getValueAt(i, 3).toString();
                         String vid = jtb_catalogo_articulos.getValueAt(i, 4).toString();
                         String vcodigo = jtb_catalogo_articulos.getValueAt(i, 5).toString();
                         String vdescripcion = jtb_catalogo_articulos.getValueAt(i, 6).toString();
                         String vitem = jtb_catalogo_articulos.getValueAt(i, 7).toString();
                         String vlinea = jtb_catalogo_articulos.getValueAt(i, 8).toString();
                         String vcosto = jtb_catalogo_articulos.getValueAt(i, 9).toString();
                         String vprecio = jtb_catalogo_articulos.getValueAt(i, 10).toString();
                         String vfeultima = jtb_catalogo_articulos.getValueAt(i, 11).toString();
                         String vobserv = jtb_catalogo_articulos.getValueAt(i, 12).toString();

                         this.creaarticulo_adddetalle_tabla(vtementrada,vtemven,vfa,vsubfam,vid,vcodigo,vdescripcion,vitem,vlinea,vcosto,vprecio,vfeultima,vobserv);
                    }
    }//GEN-LAST:event_jbtn_agregarActionPerformed
}
        private void jMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem1ActionPerformed
            // TODO add your handling code here:
    if(JOptionPane.showConfirmDialog(null, "Desea Importar Datos?")==0)
            {
                String arreglo_importa[]=this.jta_archivo.getText().split("\n");
                String arreglo_codigo[]=null;
                System.out.println("Estos tiene archivo:"+arreglo_importa.length);
                for (int i=0;i<arreglo_importa.length;i++)
                    {
                        arreglo_codigo=arreglo_importa[i].split("\t");
                        this.executabusqueda(14,1,arreglo_codigo[0].trim());
                    }
                this.jta_archivo.setText("");
            }
        }//GEN-LAST:event_jMenuItem1ActionPerformed

        private void jcbx_historialneActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jcbx_historialneActionPerformed
            // TODO add your handling code here:
            while(jtable_modelo.getRowCount()>0)jtable_modelo.removeRow(0);

}//GEN-LAST:event_jcbx_historialneActionPerformed

        private void jcbx_historialne1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jcbx_historialne1ActionPerformed
            // TODO add your handling code here:
            while(jtable_modelo.getRowCount()>0)jtable_modelo.removeRow(0);
        }//GEN-LAST:event_jcbx_historialne1ActionPerformed

        private void jrb_bclave1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jrb_bclave1ActionPerformed
            // TODO add your handling code here:
            buscamp=Integer.parseInt(evt.getActionCommand().toString());
        }//GEN-LAST:event_jrb_bclave1ActionPerformed


private void jt_articulosapromoMouseClicked(java.awt.event.MouseEvent evt) {
            // TODO add your handling code here:
        }

void registrosobtenidos()
 {
     //limpiar la tabla
    this.jlbl_cantidadregistros.setText(String.valueOf(this.jtable_modelo.getRowCount()));
    this.jlbl_textobuscado.setText(this.jtf_busqueda.getText().toUpperCase().trim());
 }

private void ponerpunto()
    {
     int numerofilas=this.jtable_modelo_promoarticulos.getRowCount();
        //this.cambiartamanofilas();
     String punto="";
             for(int i = 0 ;i < numerofilas; i++)
                {
                      //jtable_modelo_promoarticulos.setValueAt(".", i,0);
                      //jtable_modelo_promoarticulos.setValueAt(".", i,1);
                      //jtable_modelo_promoarticulos.setValueAt(".", i,2);
                      //jtable_modelo_promoarticulos.setValueAt(".", i,4);
                      //jtable_modelo_promoarticulos.setValueAt(".", i,5);
                      //jtable_modelo_promoarticulos.setValueAt(".", i,6);
                      //jtable_modelo_promoarticulos.setValueAt(".", i,9);
                      //jtable_modelo_promoarticulos.setValueAt(".", i,12);

                }
    }


private String fechaamericana(Date fe)
    {
       SimpleDateFormat formateadorestaeuropa = new SimpleDateFormat("yyyy-MM-dd");
       String cadenafecha="";
       cadenafecha= formateadorestaeuropa.format(fe);
       return cadenafecha;
    }
  private void loadcombostatus(){

            try
            {
                rs = x.sieuno_executediversosv2("select * from x1sieuno_articulo_promociones_status() as (id smallint,descrip text,observa text);",variables_global.getconexiongral());
               while (rs.next())
                    {
                      this.jcmbx_status.addItem(rs.getString("id")+":"+rs.getString("descrip"));
                    }
             }
            catch(Exception e)
            {
                System.out.println(e.getMessage());
            }
    }

    /**
    * @param args the command line arguments
    */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new articulos_sie_promociones_alta().setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.ButtonGroup buttonGroup1;
    private javax.swing.ButtonGroup buttonGroup2;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JMenu jMenu1;
    private javax.swing.JMenu jMenu2;
    private javax.swing.JMenu jMenu3;
    private javax.swing.JMenuBar jMenuBar1;
    private javax.swing.JMenuItem jMenuItem1;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel5;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JScrollPane jScrollPane4;
    private javax.swing.JButton jbtn_agregar;
    private javax.swing.JButton jbtn_buscar;
    private javax.swing.JButton jbtn_guardasolicitud;
    private javax.swing.JCheckBox jcbx_historialne;
    private javax.swing.JCheckBox jcbx_historialne1;
    private javax.swing.JComboBox jcmbx_status;
    private com.toedter.calendar.JDateChooser jdc_fechaaplica;
    private com.toedter.calendar.JDateChooser jdc_fechaprogramada;
    private com.toedter.calendar.JDateChooser jdc_fecharevision;
    private com.toedter.calendar.JDateChooser jdc_rangofinal;
    private com.toedter.calendar.JDateChooser jdc_rangoini;
    private javax.swing.JLabel jlbl_cantidadregistros;
    private javax.swing.JLabel jlbl_status;
    private javax.swing.JLabel jlbl_textobuscado;
    private javax.swing.JMenuItem jmni_escape;
    private javax.swing.JMenuItem jmni_salir;
    private javax.swing.JRadioButton jrb_bclave;
    private javax.swing.JRadioButton jrb_bclave1;
    private javax.swing.JRadioButton jrb_bdescrip;
    private javax.swing.JRadioButton jrb_bdessubfam;
    private javax.swing.JRadioButton jrb_bidfam;
    private javax.swing.JRadioButton jrb_bidsubfam;
    private javax.swing.JRadioButton jrb_bitem;
    private javax.swing.JRadioButton jrb_bprecio;
    private javax.swing.JRadioButton jrb_obaniway;
    private javax.swing.JRadioButton jrb_obcomienza;
    private javax.swing.JRadioButton jrb_obexacto;
    private javax.swing.JTable jt_articulosapromo;
    private javax.swing.JTextArea jta_archivo;
    private javax.swing.JTable jtb_catalogo_articulos;
    private javax.swing.JTextField jtf_busqueda;
    private javax.swing.JTextField jtf_describe;
    private javax.swing.JTextField jtf_observaindica;
    // End of variables declaration//GEN-END:variables

}
